<template>
	<view class="al">

		<form @submit="formSubmit" @reset="formReset" class="for">
			<view class="for">
			<view class="content">
			<label class="lable">*铁水成分C标准%:</label>
			<!-- <input class="txt" type="text" v-model="form.cCfbz" placeholder="请输入.." /> -->
			<text    class="v_input"   >{{form.cCfbz}}</text>
		</view> 
		
		<view class="content">
			<label class="lable">*铁水成分SI标准%:</label>
			<!-- <input class="txt"   type="text" v-model="form.siCfbz" placeholder="请输入.." /> -->
			<text    class="v_input"   >{{form.siCfbz}}</text>
		</view>
		<view class="content">
			<label class="lable">*铁水成分Mn标准%:</label>
			<!-- <input class="txt"   type="text" v-model="form.mnCfbz" placeholder="请输入.." /> -->
			<text    class="v_input"   >{{form.mnCfbz}}</text>
		</view>
		<view class="content">
			<label class="lable">*铁水成分S标准%:</label>
			<!-- <input class="txt"   type="text" v-model="form.sCfbz" placeholder="请输入.." /> -->
			<text    class="v_input"   >{{form.sCfbz}}</text>
		</view>
	<!-- 	<view class="content">
			<label class="lable">增碳剂C含量%:</label>
			<input  class="txt"  type="text" v-model="form.ztjCHl" placeholder="请输入.." />
		</view>
		<view class="content">
			<label class="lable">增碳剂C吸收率%:</label>
			<input class="txt"   type="text" v-model="form.ztjCXsl" placeholder="请输入.." />
		</view>
		
		
		<view class="content">
			<label class="lable">硅粒Si含量%:</label>
			<input class="txt" type="text" v-model="form.glSiHl" placeholder="请输入.." />
		</view> 
		
		<view class="content">
			<label class="lable">硅粒Si吸收率%:</label>
			<input class="txt"   type="text" v-model="form.glSiXsl" placeholder="请输入.." />
		</view>
		<view class="content">
			<label class="lable">锰铁含Mn量%:</label>
			<input class="txt"   type="text" v-model="form.mtMnHl" placeholder="请输入.." />
		</view>
		<view class="content">
			<label class="lable">锰铁Mn吸收率%:</label>
			<input class="txt"   type="text" v-model="form.mtMnXsl" placeholder="请输入.." />
		</view>
		<view class="content">
			<label class="lable">硫化铁含S量%:</label>
			<input  class="txt"  type="text" v-model="form.shtSHl" placeholder="请输入.." />
		</view>
		<view class="content">
			<label class="lable">硫化铁S吸收率%:</label>
			<input class="txt"   type="text" v-model="form.shtSXsl" placeholder="请输入.." />
		</view> -->
		
		
		
		
		
			
				<view class="content">
					<label class="lable">初测铁水成分C含量:</label>
					<input class="txt" type="number" v-model="c" placeholder="请输入.." />
				</view>

				<view class="content">
					<label class="lable">初测铁水成分Si含量:</label>
					<input class="txt" type="number" v-model="si" placeholder="请输入.." />
				</view>

				<view class="content">
					<label class="lable">初测铁水成分Mn含量:</label>
					<input class="txt" type="number" v-model="mn" placeholder="请输入.." />
				</view>

				<view class="content">
					<label class="lable">初测铁水成分S含量:</label>
					<input class="txt" type="number" v-model="s" placeholder="请输入.." />
				</view>

				<view class="content">
					<label class="lable">配料重量:</label>
					<input class="txt" type="number" v-model="pl" placeholder="请输入.." />
				</view>
				<view class="blac"></view>
				<view class="content">
					<label class="lable">增碳剂补加入量kg:</label>
					<label class="txtr">{{cadd}}</label>
				</view>
				<view class="content">
					<label class="lable">硅粒补加入量kg:</label>
					<label class="txtr">{{siadd}}</label>
				</view>
				<view class="content">
					<label class="lable">锰铁补加入量kg:</label>
					<label class="txtr">{{mnadd}}</label>
				</view>
				<view class="content">
					<label class="lable">硫化铁补加入量kg:</label>
					<label class="txtr">{{sadd}}</label>
				</view>
			</view>
			<button form-type="submit" class="btn2">计算</button>
		</form>
	</view>
</template>

<script>
	import configService from '@/common/config.service.js';
	const apiUrl = configService.apiUrl;
	export default {
		data() {
			return {
				c: '',
				si: '',
				mn: '',
				s: '',
				pl: '',
				cadd: '0',
				siadd: '0',
				mnadd: '0',
				sadd: '0',
				token: '',
				form: null
			}
		},
		mounted() {
			this.getdata();
		},
		onShow: function(e) {
			this.$verify.verify();
		},
		methods: {
			getdata() {
				uni.request({
					url: apiUrl + '/dlcftzss/list',
					header: {
						'content-type': 'application/json', //自定义请求头信息,
					},
					method: 'POST',
					data: {
						type: 1,
						deptId: uni.getStorageSync("deptId")
					},
					success: (res) => {
						if(res.statusCode === 200 && res.data.data.length > 0 ){
							this.form = res.data.data[0];
						}else{
							uni.showModal({
								title: '提示',  //提示标题
								content: '请维护电炉成分调整标准！',  //提示内容
								showCancel: true, //是否显示取消按钮
								success: function (res) {
									if (res.confirm) {  //confirm为ture，代表用户点击确定
										console.log('点击了确定按钮');
									} else if (res.cancel) {  //cancel为ture，代表用户点击取消
										console.log('点击了取消按钮');
									}
								}
							})		
						}
						// console.log(res);
						// if (res.statusCode === 200) {
						// 	self.Info = res.data;
						// }
					},
				});

			},

			opera(val) {
				this.cadd = ((val.cCfbz - this.c) / 100 * this.pl / val.ztjCHl * 100 / val.ztjCXsl * 100).toFixed(2);
				this.siadd = ((val.siCfbz - this.si) / 100 * this.pl / val.glSiHl * 100 / val.glSiXsl * 100).toFixed(2);
				this.mnadd = ((val.mnCfbz - this.mn) / 100 * this.pl / val.mtMnHl * 100 / val.mtMnXsl * 100).toFixed(2);
				this.sadd = ((val.sCfbz - this.s) / 100 * this.pl / val.shtSHl * 100 / val.shtSXsl * 100).toFixed(2);
			},
			formSubmit(e) {
				if(this.form == null ){
					uni.showToast({
						 title: "请先维护包内合金成分速算标准！",
						 icon:'error',
						 duration:1000
					})
				}
				this.opera(this.form);
			},
		}
	}
</script>

<style>
	@import url("@/common/comcss.css");
</style>